package com.company.common.req;

import com.company.common.exception.ScorpioServiceException;

import java.io.Serializable;

public class PageReq extends BaseRequest implements Serializable {
    private static final long serialVersionUID = 214818509823005725L;
    @ParamValid(allowNull = true, desc = "搜索", length = 255)
    private String searchKey;
    @ParamValid(allowNull = true, desc = "起始页", length = 255)
    private Integer pageIndex = 1;
    @ParamValid(allowNull = true, desc = "条数", length = 255)
    private Integer pageCount = 10;

    public String getSearchKey() {
        return searchKey;
    }

    public void setSearchKey(String searchKey) {
        this.searchKey = searchKey;
    }

    public Integer getPageIndex() {
        if (null == pageIndex) {
            pageIndex = 1;
        }
        return pageIndex;
    }

    @Override
    public void validate() throws ScorpioServiceException {

    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getPageCount() {
        return pageCount;
    }

    public void setPageCount(Integer pageCount) {
        this.pageCount = pageCount;
    }
}
